#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/4/7 16:22
# @File    : table_widget.py
# @Description : -i http://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
import math
import tkinter as tk
import ttkbootstrap as ttk
from tksheet import Sheet
from pandas import DataFrame


class Table(tk.Frame):

    def __init__(self,  *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.data = DataFrame()
        self.current_page = 0
        self.page_size = 10
        self.pages = 1

        self.pack(fill=tk.BOTH, expand=tk.YES)

        self.tab_frame = tk.Frame(self)
        self.tab_frame.pack(fill=tk.BOTH, padx=2, pady=1, side=tk.TOP)

        self.sheet = Sheet(self.tab_frame,
                           data=[[f"{i},{j}" for j in range(10)] for i in range(10)])
        self.sheet.enable_bindings()
        self.sheet.pack(fill=tk.BOTH, expand=True)






if __name__ == '__main__':

    app = ttk.Window("tab")
    #app = tk.Tk()

    import numpy as np

    df = DataFrame(np.random.randint(0, 100, (30, 5)))
    df.reset_index(inplace=True)
    df.columns = ["index"]+list("ABCDE")
    Table(app)

    app.mainloop()
